<template>
  <div>
    <FormulaExpressionItem
      v-for="(item, idx) in this.prop.formulaExpressionItems"
      :key="idx"
      :item="item" :idx="idx"
      @add="addItem"
      @delete="deleteItem" />
  </div>
</template>

<script>
  import FormulaExpressionItem from "./FormulaExpressionItem";
  export default {
    components:{
      FormulaExpressionItem,
    },
    props:['prop'],
    data(){
      return{
      }
    },
    methods: {
      addItem() {
        this.prop.formulaExpressionItems.push({})
      },
      deleteItem(idx) {
        this.prop.formulaExpressionItems.splice(idx, 1)
      },
    },
    created() {
      if(!this.prop.formulaExpressionItems || this.prop.formulaExpressionItems.length == 0){
        this.$set(this.prop,'formulaExpressionItems',[{}]);
      }
    }
  }
</script>

<style scoped>

</style>
